package tp.pr3.commands;

import tp.pr3.Game;
import tp.pr3.Player;
import tp.pr3.Room;
import tp.pr3.commands.exceptions.CommandExecutionException;
import tp.pr3.commands.exceptions.WrongCommandFormatException;

@SuppressWarnings("unused") public class ExamineCommand implements Command
{

	private Player _friki;
	private Room _habitacion;

	public ExamineCommand()
	{
		this._friki = null;
		this._habitacion = null;
	}

	@Override public void execute() throws CommandExecutionException
	{

		System.out.println(this._habitacion.getDescription());
		System.out.print("> ");

	}

	@Override public String getHelp()
	{
		return "EXAMINE | EXAMINAR \n";
	}

	@Override public Command parse(String cad, Game execContext)
			throws WrongCommandFormatException
	{

		if (cad.lastIndexOf(' ') != -1)
			throw new WrongCommandFormatException();

		else if (cad.equalsIgnoreCase("EXAMINE")
				|| cad.equalsIgnoreCase("EXAMINAR"))
		{
			this._friki = execContext.getPlayer();
			this._habitacion = execContext.getCurrentRoom();
			return this;
		}
		throw new WrongCommandFormatException();

	}

}
